package com.jsmtr.rms.controller.DUserResume;

import com.jsmtr.rms.entity.*;
import com.jsmtr.rms.service.*;
import com.jsmtr.rms.utils.DateTools;
import com.jsmtr.rms.utils.EnumTools;
import com.jsmtr.rms.utils.StringTools;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 应聘者已投递简历查询控制
 * @author: cyx
 * @description:
 * @date: Created in 2019/2/25 16:00
 * @modified by:
 */
@Controller
public class DUserResumeQueryController {

    @Resource
    private IUtilService utilService;

    @Resource
    private IDoResumeService doResumeService;

    @Resource
    private IProjectService projectService;


   /* @RequestMapping("/DUserResume/getusers")
    public void getusers(HttpServletRequest request, HttpServletResponse response, DUserResume resume) {
        try {
            int perpage = Integer.parseInt(request.getParameter("perpage"));
            int page = Integer.parseInt(request.getParameter("page"));
            String flowid = request.getParameter("flowid").trim();

            Map<String, Object> _map = new HashMap<String, Object>();
            _map.put("agefrom", request.getParameter("agefrom"));
            _map.put("ageto", request.getParameter("ageto"));
            _map.put("heightfrom", request.getParameter("heightfrom"));
            _map.put("heightto", request.getParameter("heightto"));
            _map.put("rcount",request.getParameter("rcount").trim());
            _map.put("usercontent", request.getParameter("usercontent"));
            _map.put("ischangejob",request.getParameter("ischangejob"));
            _map.put("msplan", request.getParameter("msplan"));
            _map.put("msplantime", request.getParameter("msplantime"));
            _map.put("msaddress", request.getParameter("msaddress"));
            _map.put("msresult", request.getParameter("msresult"));
            _map.put("scorearea", request.getParameter("scorearea"));
            _map.put("wkcompanyname", request.getParameter("wkcompanyname"));
            _map.put("wkdepartment", request.getParameter("wkdepartment"));
            _map.put("wkposition", request.getParameter("wkposition"));
            _map.put("jobdepart", request.getParameter("jobdepart"));
            _map.put("adddate", request.getParameter("adddate"));
            _map.put("adddatefrom", request.getParameter("adddatefrom"));
            _map.put("adddateto", request.getParameter("adddateto"));
            _map.put("op1",request.getParameter("op1"));
            _map.put("bdremark",request.getParameter("bdremark"));
            ProjectInfoFlow projectInfoFlow=projectService.getFolwById(flowid);

            Map<String, Object> map;
            String flowName=projectInfoFlow.getFname()==null?projectInfoFlow.getNickname():projectInfoFlow.getFname();
            if(flowName.equalsIgnoreCase("面试")){
                map=doResumeService.getMSResumesMap(page, perpage, _map,resume);
            }else if(flowName.equalsIgnoreCase("笔试")){
                map=doResumeService.getBSResumesMap(page, perpage, _map,resume);
            }else if(flowName.equalsIgnoreCase("实作")){
                map=doResumeService.getOPResumesMap(page, perpage, _map,resume);
            }else if(flowName.equalsIgnoreCase("政审")||flowName.equalsIgnoreCase("背景调查")){
                map=doResumeService.getMSResumesMap(page, perpage, _map,resume);
            }else{
                map = doResumeService.getResumesMap(page, perpage, _map,resume);
            }

            StringBuilder result = new StringBuilder();
            double pageCount = (Double) map.get("pageCount");
            double allcount = (Double) map.get("count");

            if (pageCount != 0) {
                List<HashMap> object = (List<HashMap>)map.get("list");
                for (HashMap<String,Object> _user :  object) {
                    result.append("<tr>");

                    result.append(createNomalClomns(_user,request));

                    result.append(createFlowsColumns(_user,projectInfoFlow));

                    result.append("</tr>");
                }
            } else {
                result.append("<tr><td colspan='25'>无符合条件的信息</td></tr>");
            }
            result.append("<input type='hidden' id='pageCount' value='" + pageCount + "' />");
            result.append("<input type='hidden' id='allCount' value='" + allcount + "' />");
            utilService.printTextResult(result.toString(), response);
        } catch (Exception e) {
            e.printStackTrace();
            utilService.printTextResult("<tr><td colspan='25'>系统出错了</td></tr><input type='hidden' id='pageCount' value='0' /><input type='hidden' id='allCount' value='0' />", response);
        }
    }
*/
    @ResponseBody
    @RequestMapping(value = "/DUserResume/getGxResumeListLayuiJson", method = RequestMethod.GET)
    public LayuiDataTableResultBean getGxResumeListLayuiJson(HttpServletRequest request, HttpServletResponse response, DUserResume resume) {
        try {
            int page = Integer.parseInt(request.getParameter("page"));
            int limit = Integer.parseInt(request.getParameter("limit"));
            String flowid = request.getParameter("flowid").trim();

            Map<String, Object> _map = new HashMap<String, Object>();
            _map.put("agefrom", request.getParameter("agefrom"));
            _map.put("ageto", request.getParameter("ageto"));
            _map.put("heightfrom", request.getParameter("heightfrom"));
            _map.put("heightto", request.getParameter("heightto"));
            _map.put("rcount",request.getParameter("rcount").trim());
            _map.put("usercontent", request.getParameter("usercontent"));
            _map.put("ischangejob",request.getParameter("ischangejob"));
            _map.put("msplan", request.getParameter("msplan"));
            _map.put("msplantime", request.getParameter("msplantime"));
            _map.put("msaddress", request.getParameter("msaddress"));
            _map.put("msresult", request.getParameter("msresult"));
            _map.put("scorearea", request.getParameter("scorearea"));
            _map.put("wkcompanyname", request.getParameter("wkcompanyname"));
            _map.put("wkdepartment", request.getParameter("wkdepartment"));
            _map.put("wkposition", request.getParameter("wkposition"));
            _map.put("jobdepart", request.getParameter("jobdepart"));
            _map.put("adddate", request.getParameter("adddate"));
            _map.put("adddatefrom", request.getParameter("adddatefrom"));
            _map.put("adddateto", request.getParameter("adddateto"));
            _map.put("op1",request.getParameter("op1"));
            _map.put("bdremark",request.getParameter("bdremark"));
            ProjectInfoFlow projectInfoFlow=projectService.getFolwById(flowid);

            Map<String, Object> map;
            String flowName=projectInfoFlow.getFname()==null?projectInfoFlow.getNickname():projectInfoFlow.getFname();
            if(flowName.equalsIgnoreCase("面试")){
                map=doResumeService.getMSResumesMap(page, limit, _map,resume);
            }else if(flowName.equalsIgnoreCase("笔试")){
                map=doResumeService.getBSResumesMap(page, limit, _map,resume);
            }else if(flowName.equalsIgnoreCase("实作")){
                map=doResumeService.getOPResumesMap(page, limit, _map,resume);
            }else if(flowName.equalsIgnoreCase("政审")||flowName.equalsIgnoreCase("背景调查")){
                map=doResumeService.getMSResumesMap(page, limit, _map,resume);
            }else{
                map = doResumeService.getResumesMap(page, limit, _map,resume);
            }

            double pageCount = (Double) map.get("pageCount");
            double allcount = (Double) map.get("count");

            JSONArray jsonArray = new JSONArray();
            int num = 1;
            if (pageCount != 0) {
                List<HashMap> object = (List<HashMap>)map.get("list");
                for (HashMap<String,Object> _user :  object){
                    JSONObject jsonObject = new JSONObject();
                    JSONObject jsonObject1 = new JSONObject();
                    JSONObject jsonObject2 = new JSONObject();
                    jsonObject1.put("id_cb","cb_" + _user.get("ID"));
                    jsonObject1.put("id",limit * (page - 1) + num);
                    jsonObject1.put("cardcount", Integer.parseInt(_user.get("CARDCOUNT").toString())); //投简历总次数
                    jsonObject1.put("ContextPath",request.getContextPath()+"/UserResume/ViewDResume?id=" + _user.get("ID"));
                    jsonObject1.put("NAME", _user.get("NAME"));
                    jsonObject1.put("CARDNO", _user.get("CARDNO"));
                    jsonObject1.put("SEXNAME", _user.get("SEXNAME"));
                    jsonObject1.put("JOBDEPART", (_user.get("JOBDEPART")== null ? "" : _user.get("JOBDEPART")));
                    jsonObject1.put("JNAME", _user.get("JNAME"));
                    jsonObject1.put("ADDDATE", (_user.get("ADDDATE")== null ? "" : _user.get("ADDDATE")));

                    jsonObject2 = createFlowsColumnsJson(_user,projectInfoFlow);
                    jsonObject.putAll(jsonObject1);
                    jsonObject.putAll(jsonObject2);

                    jsonArray.add(jsonObject);
                    num++;
                }
            }

            LayuiDataTableResultBean result = new LayuiDataTableResultBean();
            result.setCode(0);
            result.setMsg("success");
            result.setCount((int) allcount);
            result.setData(jsonArray);

            return result;
        } catch (Exception e) {
            e.printStackTrace();

            LayuiDataTableResultBean result = new LayuiDataTableResultBean();
            result.setCount(-1);
            result.setMsg("err");
            return result;
        }
    }

    private StringBuilder createNomalClomns(HashMap<String,Object> resume,HttpServletRequest request){
        StringBuilder columns=new StringBuilder();
        columns.append("<td><input type='checkbox' id='cb_" + resume.get("ID") + "' /></td>");
        //投简历总次数
        Integer cardcount= Integer.parseInt(resume.get("CARDCOUNT").toString());
        if (cardcount>1){
            columns.append("<td class='link'><a target='_blank' href='" + request.getContextPath() + "/UserResume/ViewDResume?id=" + resume.get("ID") + "'>" + resume.get("NAME") + "</a>&nbsp;<span class='layui-badge'>"+resume.get("CARDCOUNT")+"</span></td>");
        }else{
            columns.append("<td class='link'><a target='_blank' href='" + request.getContextPath() + "/UserResume/ViewDResume?id=" + resume.get("ID") + "'>" + resume.get("NAME") + "</a></td>");
        }
        columns.append("<td>" + resume.get("CARDNO") + "</td>");
        columns.append("<td>" + resume.get("SEXNAME") + "</td>");
        /*columns.append("<td>" + resume.get("UNIVERSITY") + "</td>");
        columns.append("<td>" + resume.get("MAJORNAME") + "</td>");*/
/*        columns.append("<td>" + (resume.get("WKCOMPANYNAME") == null ? "" : resume.get("WKCOMPANYNAME"))+ "</td>");
        columns.append("<td>" + (resume.get("WKDEPARTMENT") == null ? "" : resume.get("WKDEPARTMENT"))+ "</td>");
        columns.append("<td>" + (resume.get("WKPOSITION") == null ? "" : resume.get("WKPOSITION"))+ "</td>");
        columns.append("<td>" + (resume.get("WKENDTIME") == null ? "" : resume.get("WKENDTIME")) + "</td>");*/
        columns.append("<td>" + (resume.get("JOBDEPART") == null ? "" : resume.get("JOBDEPART")) + "</td>");
        columns.append("<td>" + resume.get("JNAME") + "</td>");
        columns.append("<td>" + (resume.get("ADDDATE") == null ? "" : resume.get("ADDDATE")) + "</td>");

        return  columns;
    }

    private JSONObject createFlowsColumnsJson(HashMap<String, Object> resume, ProjectInfoFlow projectInfoFlow) {
      //  DUserResumeJsonGxTwo drjson2 = new DUserResumeJsonGxTwo();
        //JSONObject jsonObjectTemp = JSONObject.fromObject(drjson2);
        JSONObject jsonObjectTemp = new JSONObject();
       // StringBuilder flowsColumns=null;
        String flowName=projectInfoFlow.getFname();
        if (!StringTools.trimNotEmpty(flowName)){
            flowName=projectInfoFlow.getNickname();
        }
        if (flowName.equalsIgnoreCase(EnumTools.FlowNomalState.简历筛选.name())){
            jsonObjectTemp= createResumeColumnsJson(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.笔试.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.资料审核.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.面试.name())){
            jsonObjectTemp=createInterviewColumnsJson(resume,projectInfoFlow.getId());

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.背景调查.name())||flowName.equalsIgnoreCase("政审")){
            jsonObjectTemp=createPreviewColumnsJson(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.实作.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.体检.name())){
            jsonObjectTemp=createPhysicalColumnsJson(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.签约.name())){
            jsonObjectTemp=createSigningColumnsJson(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.实习.name())){
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.录用.name())){
            jsonObjectTemp=createEmployColumnsJson(resume,projectInfoFlow.getId());
        }
        return jsonObjectTemp;
    }

    private JSONObject createResumeColumnsJson(HashMap<String, Object> resume, String flowid) {
        JSONObject jsonObjectTemp = new JSONObject();
        jsonObjectTemp.put("EDUCATIONNAME", (resume.get("EDUCATIONNAME")== null ? "" : resume.get("EDUCATIONNAME")));
        jsonObjectTemp.put("BIRTHDAY", DateTools.BirthdayToAge((Date) resume.get("BIRTHDAY")));
        jsonObjectTemp.put("ZZMMNAME", resume.get("ZZMMNAME"));
        jsonObjectTemp.put("TEL", resume.get("TEL"));
        jsonObjectTemp.put("BDREMARK", resume.get("BDREMARK"));
        if(resume.get("BDREMARK")==null||resume.get("BDREMARK").toString().equalsIgnoreCase("")){
            jsonObjectTemp.put("stateMsg", resume.get("未发送"));
        }else if(resume.get("BDREMARK").toString().indexOf("\"error_code\":0")>0){
            jsonObjectTemp.put("stateMsg", resume.get("发送成功"));
        }else{
            jsonObjectTemp.put("stateMsg", resume.get("失败"));
        }
        jsonObjectTemp.put("STATE", resume.get("STATE"));
        jsonObjectTemp.put("SXBZ", (resume.get("SXBZ")== null ? "" : resume.get("SXBZ")));
        jsonObjectTemp.put("MID", resume.get("MID"));
        jsonObjectTemp.put("MCONTENT", (resume.get("MCONTENT")== null ? "" : resume.get("MCONTENT")));

        if (resume.get("OP1") == null || resume.get("OP1").equals("未公布")) {
            jsonObjectTemp.put("STATEa", (resume.get("MCONTENT")== null ? "" : resume.get("MCONTENT")));
            jsonObjectTemp.put("STATEb", "未公布");
        } else {
            jsonObjectTemp.put("STATEa", (resume.get("MCONTENT")== null ? "" : resume.get("MCONTENT")));
            jsonObjectTemp.put("STATEb", "已公布");
        }

        jsonObjectTemp.put("FQSTATE", resume.get("FQSTATE"));
        if (resume.get("FQSTATE").equals("已放弃")&& resume.get("FQFID").equals(flowid)) {
            jsonObjectTemp.put("STATEc", "弃");
        } else {
            if (resume.get("STATE").equals("未处理")) {
                jsonObjectTemp.put("STATEc", "未");
            } else if (resume.get("STATE").equals("未通过")||resume.get("STATE").equals("不通过")||resume.get("STATE").equals("不合格")
                    ||resume.get("STATE").equals("未合格")) {
                jsonObjectTemp.put("STATEc", "完");
            } else {
                boolean bl = resume.get("FID").equals(flowid);
                if (bl){
                    jsonObjectTemp.put("STATEc", "未");
                }else{
                    jsonObjectTemp.put("STATEc", "完");
                }
                if (StringTools.trimNotEmpty(resume.get("NRID"))){
                    jsonObjectTemp.put("STATEc", "岗");
                }
            }
        }

        return jsonObjectTemp;
    }

    private JSONObject createInterviewColumnsJson(HashMap<String, Object> resume, String id) {
        JSONObject jsonObjectTemp = new JSONObject();
        return jsonObjectTemp;
    }

    private JSONObject createPreviewColumnsJson(HashMap<String, Object> resume, String id) {
        JSONObject jsonObjectTemp = new JSONObject();
        return jsonObjectTemp;
    }

    private JSONObject createPhysicalColumnsJson(HashMap<String, Object> resume, String id) {
        JSONObject jsonObjectTemp = new JSONObject();
        return jsonObjectTemp;
    }

    private JSONObject createSigningColumnsJson(HashMap<String, Object> resume, String id) {
        JSONObject jsonObjectTemp = new JSONObject();
        return jsonObjectTemp;
    }

    private JSONObject createEmployColumnsJson(HashMap<String, Object> resume, String id) {
        JSONObject jsonObjectTemp = new JSONObject();
        return jsonObjectTemp;
    }

    private StringBuilder createFlowsColumns(HashMap<String,Object> resume,ProjectInfoFlow projectInfoFlow){
        StringBuilder flowsColumns=null;
        String flowName=projectInfoFlow.getFname();
        if (!StringTools.trimNotEmpty(flowName)){
            flowName=projectInfoFlow.getNickname();
        }
        if (flowName.equalsIgnoreCase(EnumTools.FlowNomalState.简历筛选.name())){
            flowsColumns= createResumeColumns(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.笔试.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.资料审核.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.面试.name())){
            flowsColumns=createInterviewColumns(resume,projectInfoFlow.getId());

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.背景调查.name())||flowName.equalsIgnoreCase("政审")){
            flowsColumns=createPreviewColumns(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.实作.name())){

        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.体检.name())){
            flowsColumns=createPhysicalColumns(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.签约.name())){
            flowsColumns=createSigningColumns(resume,projectInfoFlow.getId());
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.实习.name())){
        }else if(flowName.equalsIgnoreCase(EnumTools.FlowNomalState.录用.name())){
            flowsColumns=createEmployColumns(resume,projectInfoFlow.getId());
        }
            return flowsColumns;
    }


    private StringBuilder createResumeColumns(HashMap<String,Object> resume,String flowid){
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + (resume.get("EDUCATIONNAME") == null ? "" : resume.get("EDUCATIONNAME"))  + "</td>");
        /*resumeColumns.append("<td>" + (resume.get("GRADUATIONTIME") == null ? "" : resume.get("GRADUATIONTIME"))  + "</td>");*/
        resumeColumns.append("<td>" + DateTools.BirthdayToAge((Date) resume.get("BIRTHDAY")) + "</td>");
        resumeColumns.append("<td>" + resume.get("ZZMMNAME") + "</td>");
        resumeColumns.append("<td>" + resume.get("TEL") + "</td>");
        if(resume.get("BDREMARK")==null||resume.get("BDREMARK").toString().equalsIgnoreCase("")){
            resumeColumns.append("<td>未发送</td>");
        }else if(resume.get("BDREMARK").toString().indexOf("\"error_code\":0")>0){
            resumeColumns.append("<td>发送成功</td>");
        }else{
            resumeColumns.append("<td>失败</td>");
        }
        resumeColumns.append("<td>" + resume.get("STATE")  + "</td>");
        resumeColumns.append("<td>" + (resume.get("SXBZ") == null ? "" : resume.get("SXBZ")) + "</td>");
        if (resume.get("OP1") == null || resume.get("OP1").equals("未公布")) {
           /* resumeColumns.append("<td></td>");*/
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            /*resumeColumns.append("<td>"+ resume.get("LOGINTIME")+"</td>");*/
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃")&& resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {
            if (resume.get("STATE").equals("未处理")) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else if (resume.get("STATE").equals("未通过")||resume.get("STATE").equals("不通过")||resume.get("STATE").equals("不合格")||resume.get("STATE").equals("未合格")) {
                resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
            } else {
                boolean bl = resume.get("FID").equals(flowid);
                if (bl){
                    resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                }else{
                    resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                }
                if (StringTools.trimNotEmpty(resume.get("NRID"))){
                    resumeColumns.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+resume.get("NJNAME")+")'>岗</span>");
                }
            }
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }

    private StringBuilder createInterviewColumns(HashMap<String,Object> resume,String flowid){
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + (resume.get("MSSTARTTIME") == null ? "" : resume.get("MSSTARTTIME")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("MSADDRESS") == null ? "" : resume.get("MSADDRESS")) + "</td>");
        //改为确认时间和确认状态
        resumeColumns.append("<td>" + (resume.get("MSISCONFIRM") == null ? "" : resume.get("MSISCONFIRM")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("MSCONFIRMTIME") == null ? "" : resume.get("MSCONFIRMTIME")) + "</td>");
        /*resumeColumns.append("<td>" + (resume.get("MSNOTICE") == null ? "" : EnumTools.NoticeState.values()[((BigDecimal) resume.get("NOTICE")).intValue()]) + "</td>");*/
        resumeColumns.append("<td>" + (resume.get("MSNOTICE") == null ? "" : resume.get("MSNOTICE")) + "</td>");
        resumeColumns.append("<td class='link'>" + (resume.get("MSPOINT") == null ? "" : "<a href=\"javascript:viewResult('" + resume.get("USERID") + "','" + resume.get("NAME") + "');\">" + resume.get("MSPOINT") + "</a>") + "</td>");
        resumeColumns.append("<td>" + (resume.get("MSRESULT") == null ? "" : resume.get("MSRESULT"))+ "</td>");
        resumeColumns.append("<td>" + (resume.get("MSREMARK") == null ? "" : resume.get("MSREMARK")) + "</td>");
        if (resume.get("OP7") == null || resume.get("OP7").equals("未公布")) {
            resumeColumns.append("<td></td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            resumeColumns.append("<td>"+ resume.get("LOGINTIME")+"</td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃") && resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {
            if (resume.get("MSRESULT") == null) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else {
                if (resume.get("MSRESULT").equals("未面试")) {
                    resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                } else if (resume.get("MSRESULT").equals("未通过")||resume.get("MSRESULT").equals("不通过")||resume.get("MSRESULT").equals("不合格")||resume.get("MSRESULT").equals("未参加")) {
                    resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                } else {
                    if (resume.get("FID").equals(flowid)) {
                        resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                    } else {
                        resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                    }
                }
            }
        }
        if (resume.get("NRID") != null) {
            resumeColumns.append("<td class='ytj'><span title='" +  resume.get("NJNAME") + "'>已推荐</span></td></tr>");
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }

    private StringBuilder createPreviewColumns(HashMap<String,Object> resume,String flowid){
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + resume.get("TEL") + "</td>");
        resumeColumns.append("<td>" + (resume.get("MSPOINT") == null ? "" : resume.get("MSPOINT")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("MSRESULT") == null ? "" : resume.get("MSRESULT")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("ZSSTATE") == null ? "" : resume.get("ZSSTATE")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("ZSREMARK") == null ? "" : resume.get("ZSREMARK")) + "</td>");
        if (resume.get("OP3") == null || resume.get("OP3").equals("未公布")||resume.get("OP3").equals("null")) {
            resumeColumns.append("<td></td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            resumeColumns.append("<td>"+ resume.get("LOGINTIME")+"</td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃") && resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {
            if (resume.get("ZSSTATE") == null) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else {
                if (resume.get("ZSSTATE").equals("未通过")||resume.get("ZSSTATE").equals("不通过")||resume.get("ZSSTATE").equals("不合格")||resume.get("ZSSTATE").equals("未合格")) {
                    resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                } else {
                    boolean bl = resume.get("FID").equals(flowid);
                    if (bl){
                        resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                    }else{
                        resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                    }
                }
            }
        }
        if (StringTools.trimNotEmpty(resume.get("NRID"))){
            resumeColumns.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+resume.get("NJNAME")+")'>岗</span>");
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }


    private StringBuilder createPhysicalColumns(HashMap<String,Object> resume,String flowid){
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + (resume.get("TJTIME") == null ? "" : resume.get("TJTIME")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("TJADDRESS") == null ? "" : resume.get("TJADDRESS")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("TJLXR")==null?"": resume.get("TJLXR")+ "" + resume.get("TJLXDH")==null?"": resume.get("TJLXDH"))+"</td>");
        resumeColumns.append("<td>" + resume.get("TJMSG") + "</td>");
        resumeColumns.append("<td>" + resume.get("TJSTATE") + "</td>");
        resumeColumns.append("<td>" + (resume.get("TJREMARK") == null ? "" : resume.get("TJREMARK")) + "</td>");

        if (resume.get("OP4") == null || resume.get("OP4").equals("未公布")) {
            resumeColumns.append("<td></td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            resumeColumns.append("<td>"+ resume.get("LOGINTIME")+"</td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃") && resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {

            if (resume.get("TJSTATE") == null) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else {
                if (resume.get("TJSTATE").equals("不合格")||resume.get("TJSTATE").equals("未通过")||resume.get("TJSTATE").equals("不通过")||resume.get("TJSTATE").equals("未参加")) {
                    resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                } else {
                    if (resume.get("FID").equals(flowid)) {
                        resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                    } else {
                        resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                    }
                }
            }

        }
        if (resume.get("NRID") != null) {
            resumeColumns.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+resume.get("NJNAME")+")'>岗</span>");
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }

    private StringBuilder createSigningColumns(HashMap<String,Object> resume,String flowid){
        if(!StringTools.trimNotEmpty(resume.get("QYSTATE"))){
            resume.put("QYSTATE","未处理");
        }
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + DateTools.BirthdayToAge((Date) resume.get("BIRTHDAY")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("GRADUATIONTIME") == null ? "" : resume.get("GRADUATIONTIME")) + "</td>");
        resumeColumns.append("<td>" + resume.get("ZZMMNAME") + "</td>");
        resumeColumns.append("<td>" + resume.get("TEL") + "</td>");
        resumeColumns.append("<td>" + resume.get("QYSTATE")  + "</td>");
        resumeColumns.append("<td>" + (resume.get("QYREMARK") == null ? "" : resume.get("QYREMARK")) + "</td>");
        if (resume.get("OP9") == null || resume.get("OP9").equals("未公布")) {
            resumeColumns.append("<td></td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            resumeColumns.append("<td>"+ resume.get("LOGINTIME")+"</td>");
            resumeColumns.append("<td><input type='hidden' value='"+resume.get("MID")+"'>"+ (resume.get("MCONTENT") == null ? "" : resume.get("MCONTENT")) + "</td>");
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃")&& resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {
            if (!StringTools.trimNotEmpty(resume.get("QYSTATE"))||resume.get("QYSTATE").equals("未处理")) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else if (resume.get("QYSTATE").equals("未通过")||resume.get("QYSTATE").equals("不通过")||resume.get("QYSTATE").equals("不合格")||resume.get("QYSTATE").equals("未合格")) {
                resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");

            }else if(resume.get("QYSTATE").equals("违约")){
                resumeColumns.append("<span class='layui-badge layui-bg-green' title='违约'>违</span>");
            }else if(resume.get("QYSTATE").equals("放弃签约")){
                resumeColumns.append("<span class='layui-badge layui-bg-green' title='放弃签约'>放</span>");
            } else {
                boolean bl = resume.get("FID").equals(flowid);
                if (bl){
                    resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
                }else{
                    resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
                }
                if (StringTools.trimNotEmpty(resume.get("NRID"))){
                    resumeColumns.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+resume.get("NJNAME")+")'>岗</span>");
                }
            }
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }


    private StringBuilder createEmployColumns(HashMap<String,Object> resume,String flowid){
        StringBuilder resumeColumns=new StringBuilder();
        resumeColumns.append("<td>" + (resume.get("BDTIME") == null ? "" : resume.get("BDTIME")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("BDADDRESS") == null ? "" : resume.get("BDADDRESS")) + "</td>");
        resumeColumns.append("<td>" + (resume.get("BDLXR") == null ? "" : (resume.get("BDLXR") + " " + resume.get("BDLXR"))) + "</td>");
        resumeColumns.append("<td>" + resume.get("BDMSG") + "</td>");
        resumeColumns.append("<td>" + resume.get("BDSTATE") + "</td>");
        if (resume.get("OP5") == null || resume.get("OP5").equals("未公布")) {
            resumeColumns.append("<td class='true'><span>未公布</span></td>");
        } else {
            resumeColumns.append("<td class='false'><span>已公布</span></td>");
        }
        resumeColumns.append("<td>");
        if (resume.get("FQSTATE").equals("已放弃")&& resume.get("FQFID").equals(flowid)) {
            resumeColumns.append("<span class='layui-badge layui-bg-gray' title='已放弃'>弃</span>");
        } else {
            if (resume.get("BDSTATE").equals("未报到")) {
                resumeColumns.append("<span class='layui-badge layui-bg-orange' title='未完成'>未</span>");
            } else {
                resumeColumns.append("<span class='layui-badge layui-bg-green' title='已完成'>完</span>");
            }
        }
        if (resume.get("NRID") != null) {
            resumeColumns.append("<span class='layui-badge layui-bg-blue' title='转岗(原岗位:"+resume.get("NJNAME")+")'>岗</span>");
        }
        resumeColumns.append("</td>");
        return  resumeColumns;
    }

}
